﻿using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Http.Client;
using Volo.Abp;
using System.Diagnostics.CodeAnalysis;
using Volo.Abp.Modularity;

namespace Qianke.Core.Saas.HttpApi.Client.Common
{
    public static class SaasServiceCollectionHttpClientProxyExtensions
    {
        public static IServiceCollection AddHttpClientProxies<TModule>(
    [NotNull] this IServiceCollection services,
    [NotNull] string remoteServiceConfigurationName = RemoteServiceConfigurationDictionary.DefaultName,
    bool asDefaultServices = true,
    ApplicationServiceTypes applicationServiceTypes = ApplicationServiceTypes.All)
            where TModule : AbpModule
        {
            var assembly = Assembly.GetAssembly(typeof(TModule));
            return services.AddHttpClientProxies(assembly, remoteServiceConfigurationName, asDefaultServices, applicationServiceTypes);
        }
    }
}
